package algotithm.leetcode.dp.test1553;

import java.util.HashMap;

/**
 * @author 25068
 * @Date 2021/5/3 9:38
 * @Title 1553.吃掉 N 个橘子的最少天数
 */
public class Solution {


    public static void main(String[] args) {
        int n = 10;
        Solution solution = new Solution();
        int res = solution.minDays(n);
        System.out.println(res);
    }

    public int minDays(int n) {
        HashMap<Integer, Integer> map = new HashMap<>();
        if (n <= 1) {
            return n;
        }
        if (map.containsKey(n)) {
            return n;
        }
        map.put(n,Math.min(n % 2 + 1 + minDays(n / 2),n % 3 + 1 + minDays(n / 3)));
        return map.get(n);
    }

}
